<template>
  <el-dialog v-dialogDrag :visible.sync="dialogVisible" title="设备维修详情" width="1000px" @close="resetForm('ruleForm')">
    <button-group ref="buttonGroup" @cancel="dialogVisible = false" />
    <div class="formTopFont">维修详情单</div>
    <el-table ref="tableData" v-loading="loading" height="400px" :data="tableData" stripe border>
      <el-table-column align="center" type="index" label="索引" width="60px" />
      <el-table-column prop="applyNo" label="维修申请单" width="200px" show-overflow-tooltip />
      <el-table-column label="维修方式" width="120px" show-overflow-tooltip>
        <template #default="{ row }">{{row.repairMethod === 0 ? '待确认' : row.repairMethod === 1 ? '内修':'外修'}}</template>
      </el-table-column>
      <el-table-column prop="userStr" label="维保商" width="200px" show-overflow-tooltip />
      <el-table-column prop="startTime" label="开始时间" width="200px" show-overflow-tooltip />
      <el-table-column prop="endTime" label="结束时间" width="200px" show-overflow-tooltip />
      <el-table-column prop="repairHours" label="维修工时（小时）" width="200px" show-overflow-tooltip />
      <el-table-column prop="repairCost" label="维修成本（元）" width="200px" show-overflow-tooltip />
    </el-table>
    <pagination ref="Pagination" :total="total" :current.sync="search.current" :size.sync="search.size" @pagination="details" />
  </el-dialog>
</template>
<script>
import Pagination from '@/components/Pagination'
export default {
  components: {
    Pagination
  },
  props: {
    userAllList: {
      type: Array,
      default: () => {
        return []
      }
    }
  },
  data() {
    return {
      loading: false,
      tableData: [],
      dialogVisible: false,
      search: {
        current: 1,
        size: 20
      },
      total: 0,
      obj: {}
    }
  },
  watch: {},
  mounted() {},
  methods: {
    async showDialog(row) {
      this.obj = row
      this.details()
      this.dialogVisible = true
    },
    async details() {
      const res = await this.$axios.post(
        `/equip/repair/statistical/getRepairByEquip/${this.obj.equipId}`,
        this.search
      )
      if (res.data.code === 200) {
        this.tableData = res.data.data.list
        this.total = res.data.data.total
        setTimeout(() => {
          this.loading = false
        }, 100)
      } else {
        this.loading = false
      }
    },
    /**
     * @description: 重置表单
     * @param {*} formName
     * @return {*}
     */
    resetForm() {}
  }
}
</script>
<style lang='scss' scoped>
</style>
